home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
magazine
/
dbms_mag
/
9105
/
ehrmann.may
next >
Wrap
Text File
|
1991-03-27
|
4KB
|
180 lines
LISTING 1.
; ------------------------------------------------------------
; Export Customer table to a text file
;
; This module steps through the Paradox menus to export a
; table to an ASCII text file. If the file already exists,
; it will be replaced automatically.
; ------------------------------------------------------------
Proc EXPORT_CUSTOMER()
message "Exporting Customer Table to CUSTREP.TXT"
Menu
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
select "CUSTOMER"
select "CUSTREP.TXT"
If MenuChoice() = "Cancel" then
{Replace}
EndIf
Return
EndProc
LISTING 2.
; ------------------------------------------------------------
; Export Customer table to a text file
; ------------------------------------------------------------
Proc EXPORT_CUSTOMER()
message "Exporting Customer Table to CUSTREP.TXT"
Menu
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
select "CUSTOMER"
select "CUSTREP.TXT"
If MenuChoice() = "Cancel" then
{Replace}
EndIf
Return
EndProc
; here is where the proc is actually invoked!
EXPORT_CUSTOMER()
LISTING 3.
; ------------------------------------------------------------
; Export Customer table to a text file
; ------------------------------------------------------------
Proc EXPORT_CUSTOMER()
Private X ; holding variable for file extension
X = ".TXT" ; assign value to the variable
message "Exporting Customer Table to CUSTREP" + X
Menu
{Tools} {ExportImport} {Export} {ASCII} {Delimited}
select "CUSTOMER"
select "CUSTREP" + X
If MenuChoice() = "Cancel" then
{Replace}
EndIf
Return
EndProc
LISTING 4.
; ------------------------------------------------------------
; Export Customer table to a text file
; ------------------------------------------------------------
Proc EXPORT_TABLE ( TABLE.TO.EXPORT, ; table being exported
DESTINATION.FILE, ; file to export to
EXPORT.DESCRIPTION ; description of export
)
message "Exporting the " + EXPORT.DESCRIPTION + " Table"
Menu {Tools} {ExportImport} {Export} {ASCII}
Select TABLE.TO.EXPORT
Select DESTINATION.FILE
If MenuChoice() = "Cancel" then
{Replace}
EndIf
Return
EndProc
LISTING 5
; ------------------------------------------------------------
; Send a standard message to the user
; ------------------------------------------------------------
proc USER_MESSAGE ( MESSAGE.TEXT , ; text to display
MESSAGE.COLOR , ; "R"=Regular "E"=Error
DO.KEYPRESS ; pause for a keypress ?
)
; set color to use for writing the message
; once we test MESSAGE.COLOR as passed into the proc,
; we don't need it again. So we reuse it for the actual color
if MESSAGE.COLOR = "E" then
MESSAGE.COLOR = syscolor(3) ; use Pdox error color
else
MESSAGE.COLOR = syscolor(0) ; use Pdox regular color
endif
; paint top two lines of screen
paintcanvas fill " "
attribute MESSAGE.COLOR
0, 0, 1, 79
style attribute MESSAGE.COLOR
; do we need to pause.
if DO.KEYPRESS = True then
; on which line do we write the keypress message
if len(MESSAGE.TEXT) < 65 then
@ 0,0 ?? MESSAGE.TEXT + ". Press a key."
else
@ 0,0 ?? MESSAGE.TEXT + "."
@ 1,0 ?? "Press a key to continue."
endif
; pause for a keypress; clean up
retval = getchar()
paintcanvas fill " "
attribute syscolor(0)
0, 0, 1, 79
style
; return the key pressed - we can trap for special keys
return retval
else
; no pause; paint message and continue
@ 0,0 ?? MESSAGE.TEXT
style
return False
endif
endproc